#include "flash_blob.h"

static const uint32_t flash_code[] =
{
    0XE00ABE00,0X062D780D,0X24084068,0XD3000040,0X1E644058,0X1C49D1FA,0X2A001E52,0X4770D1F2,
    0X4770BA40,0X4770BAC0,0X4603B510,0X7080F44F,0X60204CDA,0X680048DA,0X0007F040,0X60204CD8,
    0X616048D8,0X48D6BF00,0XF0006900,0X28000001,0X48D5D1F9,0X60604CD2,0X606048D4,0X4CD448D1,
    0XBF006020,0X1F0048D2,0XF0006800,0X28000001,0X48CDD1F8,0X3C104CCE,0X48CC6020,0XF8C44CC8,
    0X46200104,0X200069C0,0X4601BD10,0X68C048C4,0X0001F040,0X60D04AC2,0X380848C5,0XF0406800,
    0XF8C20001,0X2000010C,0XBF004770,0X690048BC,0X0001F000,0XD1F92800,0X68C048B9,0X0030F020,
    0X60C849B7,0X68C04608,0X0008F040,0X460860C8,0XF04068C0,0X60C80080,0X48B1BF00,0XF0006900,
    0X28000001,0X48AED1F9,0XF02068C0,0X49AC0008,0XBF0060C8,0X1F0048AE,0XF0006800,0X28000001,
    0X48ABD1F8,0X68003808,0X0030F020,0XF8C149A4,0X4608010C,0X010CF8D0,0X0008F040,0X010CF8C1,
    0XF8D04608,0XF040010C,0XF8C10080,0XBF00010C,0X1F00489F,0XF0006800,0X28000001,0X489CD1F8,
    0X68003808,0X0008F020,0XF8C14995,0X2000010C,0XB5104770,0XF3C14601,0XF1B14243,0XD3366F00,
    0X6F01F1B1,0X488ED233,0X4B8E6940,0X4B8C4318,0XBF006158,0X6900488A,0X0001F000,0XD1F92800,
    0X68C04887,0X0030F020,0X60D84B85,0X68C04618,0XEA432304,0X43182302,0X60D84B81,0X68C04618,
    0X0080F040,0XBF0060D8,0X6900487D,0X0001F000,0XD1F92800,0X68C0487A,0X0004F020,0X60D84B78,
    0X69004618,0X0001F000,0X2001B3F0,0X4878BD10,0X4B746800,0X4B724318,0X0114F8C3,0X4874BF00,
    0X68001F00,0X0001F000,0XD1F82800,0X38084870,0XF0206800,0X4B6A0030,0X010CF8C3,0X3808486C,
    0XF1A26800,0X24040308,0X2303EA44,0X4B644318,0X010CF8C3,0XF8D04618,0XF040010C,0XF8C30080,
    0XBF00010C,0X1F004862,0XF0006800,0X28000001,0X485FD1F8,0X68003808,0X0004F020,0XF8C34B58,
    0X485B010C,0XE0001F00,0X6800E005,0X0001F000,0X2001B108,0X2000E7BA,0XB5F0E7B8,0X460C4603,
    0X46194616,0X22004635,0X6F00F1B3,0XF1B3D30D,0XD20A6F01,0X484ABF00,0XF0006900,0X28000001,
    0X4848D1F9,0X61784F46,0XBF00E00A,0X1F004848,0XF0006800,0X28000001,0X4842D1F8,0X60384F44,
    0XF1B3E078,0XD3066F00,0X6F01F1B3,0X2002D203,0X60F84F3B,0X2002E003,0X3F084F3D,0X2C206038,
    0X2200D30C,0X682FE006,0X600F6868,0X35086048,0X1C523108,0XDBF62A04,0XE0133C20,0XE0042200,
    0X0B01F815,0X0B01F801,0X42A21C52,0X2200D3F8,0X20FFE003,0X0B01F801,0XF1C41C52,0X42900020,
    0X2400D8F7,0X8F4FF3BF,0X6F00F1B3,0XF1B3D30A,0XD2076F01,0X4822BF00,0XF0006900,0X28000001,
    0XE007D1F9,0X4822BF00,0X68001F00,0X0001F000,0XD1F82800,0X6900481A,0XB1B02000,0X6F00F1B3,
    0XF1B3D309,0XD2066F01,0X68C04815,0X0002F020,0X60F84F13,0X4816E007,0X68003808,0X0002F020,
    0XF8C74F0F,0X2001010C,0XF1B3BDF0,0XD3096F00,0X6F01F1B3,0X480AD206,0XF02068C0,0X4F080002,
    0XE00760F8,0X3808480A,0XF0206800,0X4F040002,0X010CF8C7,0XD1842C00,0XE7E52000,0X58024594,
    0X52002000,0X0FEF000E,0X45670123,0XCDEF89AB,0X52002114,0X00000000,
};

const program_target_t flash_algo_STM32H7XX =
{
    0X20000020,  // Init
    0X2000008B,  // UnInit
    0X200000AB,  // EraseChip
    0X20000153,  // EraseSector
    0X2000025B,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0X20000001,
        0X20000C00,
        0X20001000,
    },

    0x20000400,                      // mem buffer location
    0x20000000,                      // location to write prog_blob in target RAM
    sizeof(flash_code),              // prog_blob size
    flash_code,                      // address of prog_blob
    0x00000400,                      // ram_to_flash_bytes_to_be_written
};
